const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: "./src/index.js",
    output: {
        path: __dirname + "/dist",
        filename: "index.js"
    },
    mode: "development",
    devServer: {
        port: 3333,
        open: true
    },
    // 解析其他文件
    module: {
        // 规则
        rules: [
            {
                // .css结尾
                test: /\.css$/i,
                use: ["style-loader", "css-loader"],
            },
            {
                test: /\.(jpg|png|jpeg|gif)$/i,
                use: ["file-loader"],
            },
        ],
    },
    plugins: [new HtmlWebpackPlugin({ template: './public/index.html' })],
}